#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define LEN 999

typedef struct Arr {
    int n;
    char arr[0];
}Arr;

void MoveForward(char *arr, int len) {
    arr[0] = arr[1];
    if (len > 1) {
        MoveForward(arr + 1, len - 1);
    }
};

int Delete(char *arr, int len, char ch) {
    if (*arr == ch) {
        MoveForward(arr, len);
        return Delete(arr, len - 1, ch);
    } else if (len) {
        return 1 + Delete(arr + 1, len - 1, ch);
    }
    return 0;
}

int main() {
    char ch = 0;
    int len = LEN;
    Arr *arr = (Arr *) malloc(sizeof(Arr) + len * sizeof(char));
    if (arr == NULL) {
        perror("堆区开辟空间失败:");
    }
    scanf("%s", arr->arr);
    if (getchar() == '\n') {
        scanf("%c", &ch);
    }
    Delete(arr->arr, strlen(arr->arr), ch);
    puts(arr->arr);
    free(arr);
    arr = NULL;
    return 0;
}